﻿@{ 
    List<Galaxy.Entities.Role> roleList = ViewData["RoleList"] as List<Galaxy.Entities.Role>;
}
@section styles{
    <link href="~/lib/AdminLTE/plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" asp-append-version="true" />
    <link href="~/lib/bootstrapvalidator/dist/css/bootstrapValidator.min.css" rel="stylesheet" asp-append-version="true" />
    <link href="~/css/base.css" rel="stylesheet" asp-append-version="true" />
    <style type="text/css">
        .trchange {
            background-color: #08C;
            color: white;
        }
    </style>
}
@section scripts{ 
    <script src="~/lib/bootstrapvalidator/dist/js/bootstrapValidator.min.js" asp-append-version="true"></script>
    <script src="~/view-resources/Views/Roles/Index.js" asp-append-version="true"></script>
}
<div class="content-wrapper" id="mainDiv" style="min-height: 935px;">
    <section class="content-header">
        <h1>角色管理</h1>
        <ol class="breadcrumb">
            <li><a href=""><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">系统管理</a></li>
            <li class="active">角色管理</li>
        </ol>
    </section>
    <!--隐藏域 begin-->
    <input type="hidden" id="pageIndex" value="@ViewBag.PageIndex" />
    <input type="hidden" id="pageSize" value="@ViewBag.PageSize" />
    <input type="hidden" id="userKey" value="@ViewBag.UserKey" />
    <input type="hidden" id="roleKey" value="@ViewBag.RoleKey" />
    <!--隐藏域 end-->
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <!-- /.col -->
            <div class="col-md-7">
                <div class="box box-primary">
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div id="role_table_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="dataTables_filter" id="searchDiv">
                                        <input placeholder="请输入名称" name="name" class="form-control" type="search" likeoption="true">
                                        <div class="btn-group">
                                            <button type="button" class="btn btn-primary" data-btn-type="searchRole">查询</button>
                                        </div>
                                        <div class="btn-group">
                                            <button type="button" class="btn btn-default" data-btn-type="addRole">新增</button>
                                            <button type="button" class="btn btn-default" data-btn-type="editRole">编辑</button>
                                            <button type="button" class="btn btn-default" data-btn-type="deleteRole">删除</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12">
                                    <table id="role_table" class="table table-bordered table-striped table-hover dataTable no-footer" style="width: 100%;" role="grid">
                                        <thead>
                                            <tr role="row">
                                                <th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="序号">序号</th>
                                                <th class="text-center sorting" tabindex="0" aria-controls="role_table" rowspan="1" colspan="1" aria-label="名称: activate to sort column ascending">名称</th>
                                                <th class="text-center sorting" tabindex="0" aria-controls="role_table" rowspan="1" colspan="1" aria-label="编码: activate to sort column ascending">编码</th><th class="text-center sorting" tabindex="0" aria-controls="role_table" rowspan="1" colspan="1" aria-label="是否可用: activate to sort column ascending">是否可用</th>
                                                <th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="备注">备注</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            @for (int i = 0; i < roleList.Count; i++)
                                            {
                                                <tr id="@roleList[i].Id" role="row" class='@(i % 2 == 0 ? "even" : "odd")'>
                                                    <td class="text-center sorting_1">@(i + 1)</td>
                                                    <td class=" text-center">@roleList[i].Name</td>
                                                    <td class=" text-center">@roleList[i].Code</td>
                                                    <td class=" text-center">@(roleList[i].Status == 0 ? "可用" : "不可用")</td>
                                                    <td class=" text-center">@roleList[i].Remark</td>
                                                </tr>
                                            }
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-5"></div>
                                <div class="col-sm-7"></div>
                            </div>
                        </div>
                    </div>
                    <!-- /.box-body -->
                </div>
            </div>
            <div class="col-md-5">
                <!-- Profile Image -->
                <div class="box box-primary">
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div id="userRole_table_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="dataTables_filter" id="searchDiv_userRole">
                                        <h5 id="roleName" class="pull-left">【一般用户】</h5>
                                        <input type="hidden" name="roleId" value="402880eb5c4ec2a4015c4ec591390000" id="roleId">
                                        <input placeholder="请输入用户名" name="user.name" class="form-control" type="search" likeoption="true">
                                        <div class="btn-group">
                                            <button type="button" class="btn btn-primary" data-btn-type="searchUser">查询</button>
                                        </div>
                                        <div class="btn-group">
                                            <button type="button" class="btn btn-default" data-btn-type="selectUser">选择</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12">
                                    <table id="userRole_table" class="table table-bordered table-striped table-hover dataTable no-footer" style="width: 100%;" role="grid" aria-describedby="userRole_table_info">
                                        <thead>
                                            <tr role="row">
                                                <th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="序号">序号</th>
                                                <th class="text-center sorting" tabindex="0" aria-controls="userRole_table" rowspan="1" colspan="1" aria-label="用户名: activate to sort column ascending">用户名</th>
                                                <th class="text-center sorting" tabindex="0" aria-controls="userRole_table" rowspan="1" colspan="1" aria-label="登录名: activate to sort column ascending">登录名</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
        </div>
        <!-- /.row -->
    </section>
</div>
<!--页面弹出框-角色增加修改 begin-->
<div id="roleWin" class="modal fade in" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 600px; margin: 286px auto;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    <i class="fa fa-remove"></i>
                </button>
                <h5 class="modal-title">新增角色</h5>
            </div>
            <div class="modal-body">
                <form id="role-form" name="role-form" class="form-horizontal bv-form" novalidate="novalidate">
                    <input type="hidden" name="id" id="id" />
                    <input type="hidden" name="createDate" id="createDate" data-flag="date" data-format="yyyy-mm-dd hh:ii:ss" />
                    <input type="hidden" name="permissionIds" id="permissionIds" />
                    <div class="box-body">
                        <div class="col-md-12">
                            <div class="form-group has-feedback">
                                <label for="name" class="col-sm-2 control-label">名称</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="name" name="name" placeholder="名称" data-bv-field="name" />
                                </div>
                            </div>
                            <div class="form-group has-feedback">
                                <label for="code" class="col-sm-2 control-label">编码</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="code" name="code" placeholder="编码" data-bv-field="code" />
                                </div>
                            </div>
                            <div class="form-group has-feedback">
                                <label for="sort" class="col-sm-2 control-label">排序</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="sort" name="sort" placeholder="排序" data-bv-field="sort" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="deleted" class="col-sm-2 control-label">是否可用</label>
                                <div class="col-sm-9">
                                    <label class="control-label">
                                        <input type="radio" name="status" class="square-green" checked="checked" value="0" /> 启用
                                    </label> &nbsp;&nbsp;&nbsp; 
                                    <label class="control-label">
                                        <input type="radio" name="status" class="square-green" value="1" /> 禁用
                                    </label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-2 control-label">说明</label>
                                <div class="col-sm-9">
                                    <textarea class="form-control" id="remark" name="remark" placeholder="说明"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer text-right">
                        <button type="button" class="btn btn-default" data-btn-type="cancel" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary" data-btn-type="roleSave">提交</button>
                    </div>
                    <!-- /.box-footer -->
                    <input type="hidden" value="">
                </form>
            </div>
        </div>
    </div>
</div>
<!--页面弹出框-角色增加修改 end-->
